package com.broadengate.dao.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.broadengate.dao.WithdrawDao;
import com.broadengate.model.Card;
import com.broadengate.model.Transfer;
import com.broadengate.model.Withdraw;

/******
 * 提供取款时与数据库的交互方法
 * 方法主要有withdraw()实现取款；deleteDraw()实现删除取款机里
 */
public class WithdrawDaoImpl extends HibernateDaoSupport implements WithdrawDao {
	public void withdraw(Card card, Withdraw withdraw) {
		getHibernateTemplate().update(card);
		getHibernateTemplate().save(withdraw);
	}
	
	public void deleteDraw(String cardNO){
		
		List<Withdraw> list = new ArrayList<Withdraw>();
		list= getHibernateTemplate().find("from Withdraw withdraw where withdraw.card.cardNo='"+cardNO+"'");	
		list.clear();
	}
}
